<template>
  <div class="container">
    <DataList
      ref="dataList"
      :propAutoFetchData="true"
      :propNoCheck="true"
      :propSearchFields="['nickname', 'loginKey']"
      :propSearchTextAppend="'账号,昵称'"
      propUrl="/upms/users/pageCommon"
      :showFieldList="cpShowFieldList"
      :vanFieldLabelWith5="true"
      :sortDefault="{field: 'nickname',type: 'asc'}"
      :btnTopConfig="btnTopConfig"
      :propPreQueryWrapper="$newWrapper().ne('loginKey', 'admin')"
    >
    </DataList>
  </div>
</template>

<script>

export default {
  help: '已供货医院-列表',
  data() {
    return {
      //
      btnTopConfig: [
        {
          key:'reset',
          title: '重置密码',
          theme: global.constCommon.themeMap.danger,
          actionAddr: '/upms/users/{id}/resetPassword',
          actionType: 'post',
          withData: true,
          confirmMsgFun(row) {
            return `确认重置账户【${row.loginKey}】为默认密码么?`
          }
        }
      ]
    }
  },
  methods: {
  },
  computed: {
    cpShowFieldList() {
      /** 配置说明
       ,sortDisabled: true 不可排序
       ,filterDisabled: true  更多搜索时不展示
       ,filterOrder: 1  更多搜索字段显示顺序，不指定则按照传入字段顺序，可以只改某些字段顺序为负数，这样就可以排前面
       ,showDisabled: true  列表内容区域不显示
       ,showFormOpenDisabled: true  详情表单不显示
       ,showAllDisabled: true   表格、表单、搜索都不显示
       ,titleSubWithLabel: true   内容显示标题
       **/

      let fieldList = [
        { label: '昵称', name: 'nickname', span: 12,isTitle: true },
        { label: '账号', name: 'loginKey', span: 12, isTitleSub: true },
        { label: '所在部门', name: 'officeName', span: 12 },
        {
          label: '启用', name: 'inactive', span: 12, flagBoolean: true,
          queryType: this.constCommon.formItemType.switch.name,
          queryConfig: {
            dictType: this.constCommon.dictType.commonYesNo
          }
        },
        { label: '联系电话', name: 'mobile', span: 12 },
      ]
      return fieldList
    }
  }
}
</script>
